package com.wdz.controller;

import com.wdz.http.Response;
import com.wdz.websocket.WebSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;

@RestController
@RequestMapping("/api")
public class WebSocketController {
    @Autowired
    private WebSocket webSocket;

    /**
     * 发送一条消息
     */
    @PostMapping("/sendAdmin")
    public Response sendAdmin(@RequestParam String d) throws IOException {
        System.out.println(d);
        webSocket.sendAll(d);
        return Response.success();
    }

}
